<?php
require 'QueryList.class.php';

header("Content-type:text/html;charset=utf-8");
$pattern = array("title" => array(".listtitle p", "title"),"content" => array(".content", "text"),"img" => array("ul li img", "src"));
$url = "http://ckl.59156.cn/home/product/index/topid/2.html";
$qy = new QueryList($url, $pattern, '', '', 'utf-8');
$rs = $qy->jsonArr;

echo '<pre>';
print_r($rs);
echo '</pre>';


$ul = "<ul>";
foreach($rs as $v){
    $ul .= "<li class='tit'>".$v['title']."</li>";
    $ul .= "<li class='tit'><img src='http://ckl.59156.cn/".$v['img']."'></li>";

}
$ul .= "</ul>";
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>演示：phpQuery强大的采集器 - 白月网</title>
        <meta name="keywords" content="phpQuery,小偷采集" />
        <meta name="description" content="phpQuery一款选择插件，支持检索，多选，下面与大家分享下其使用示例，调用方法很简单，你可以很方便的应用到你的项目中。" />
<style type="text/css">
html,body{font-size:12px; font-family:Arial,Lucida,Verdana,"寰蒋闆呴粦","瀹嬩綋",Helvetica,sans-serif; line-height:24px;margin:0;padding:0;color:#222;background:#fff;}
.ckeditor{line-height:1.2em;}
ul,li,ol.dl,dt,dd,h1,h2,h3,p{padding:0; margin:0; list-style:none;}
a{color:#7C5EA8; text-decoration:none;}
a:hover{color:#7C5EA8;}
.container{width:800px; margin:30px auto; border:1px solid #ccc; border-radius:8px;}
.demo{padding:15px;}
.tit{margin-top:10px;}
h2{border-bottom:1px solid #ccc;}
.notice{color:#999; line-height:30px;}
.des{line-height:20px; color:#999;}
</style>
    </head>
    <body>

        <div class="container">
            <div class="demo">
                
               <?php echo $ul;?>
            </div>
        </div>
        
    </body>
</html>



